package sz.szsmk.citizencard.ui.dzsmkavtivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;

import sz.szsmk.citizencard.R;
import sz.szsmk.citizencard.dialog.DiscountDialog;
import sz.szsmk.citizencard.dialog.PasswordDialog;
import sz.szsmk.citizencard.ui.activity.SetPayPasswordActivity;
import sz.szsmk.citizencard.ui.base.IBaseActivity;

/**
 * Copyright (c)2018
 * author: zdh
 * created on: 2018/11/5 11:30
 * description:
 */
public class BankAdminActivity extends IBaseActivity {

    RelativeLayout bankAdminZd;
    RelativeLayout bankAdminAdd;
    RelativeLayout bankAdminZx;

    @Override
    protected int attachLayoutRes() {
        return R.layout.bank_admin_activity;
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initViews() {

    }

    @Override
    protected void updateViews() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bankAdminZd = findViewById(R.id.bank_admin_zd);
        bankAdminAdd= findViewById(R.id.bank_admin_add);
        bankAdminZx= findViewById(R.id.bank_admin_zx);

        bankAdminZd.setOnClickListener(this::onViewClicked);
        bankAdminAdd.setOnClickListener(this::onViewClicked);
        bankAdminZx.setOnClickListener(this::onViewClicked);
    }

    public void onViewClicked(View view) {
        int id = view.getId();
        if (id == R.id.bank_admin_zd) {
            DiscountDialog cantCloseDialog = new DiscountDialog();

            cantCloseDialog.setAction(1);
            cantCloseDialog.setTitle("五折优惠助力绿色出行");
            cantCloseDialog.setContent("  电子市民卡新的托管行“建行”上线啦！用户可在“我的钱包”里面，选择更换退换行，选择建设银行，更换成功即可参与“建行五折优惠助力绿色出行”的活动~~~");
            cantCloseDialog.setOnCancelClickListener(new DiscountDialog.OnCancelClickListener() {
                @Override
                public void onCancelClick() {
                    Toast.makeText(BankAdminActivity.this, "OnCancelClickListener", Toast.LENGTH_SHORT).show();
                }
            });
            cantCloseDialog.setOnOkClickListener(new DiscountDialog.OnOkClickListener() {
                @Override
                public void onOkClick() {
                    Toast.makeText(BankAdminActivity.this, "OnOkClickListener", Toast.LENGTH_SHORT).show();

                }
            });
            cantCloseDialog.show(this.getFragmentManager(), null);
        } else if (id == R.id.bank_admin_add) {
            PasswordDialog passwordDialog = new PasswordDialog();
            passwordDialog.setAction(1);
            passwordDialog.setContent("开启后，再次进入电子市民卡需要输入手势密码哦！请牢记您的密码！");
            passwordDialog.setTitle("是否开启密码保护？");
            passwordDialog.setCancelText("我是取消");
            passwordDialog.setOkText("我是确定");
            passwordDialog.setOnCancelClickListener(new PasswordDialog.OnCancelClickListener() {
                @Override
                public void onCancelClick() {
                    Toast.makeText(BankAdminActivity.this, "取消", Toast.LENGTH_SHORT).show();
                }
            });
            passwordDialog.setOnOkClickListener(new PasswordDialog.OnOkClickListener() {
                @Override
                public void onOkClick() {
                    Toast.makeText(BankAdminActivity.this, "开启", Toast.LENGTH_SHORT).show();
                }
            });
            passwordDialog.show(this.getFragmentManager(), null);
        } else if (id == R.id.bank_admin_zx) {
            Intent intent = new Intent(this, SetPayPasswordActivity.class);
            startActivity(intent);
        }
    }
}
